package mainPackage;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class DisplayInfo extends JFrame {

	private boolean doFullScreen;
	
	public DisplayInfo() {
		
		this.setBounds(0, 0, 250, 100);
		Toolkit tools = Toolkit.getDefaultToolkit();
		Dimension screen = tools.getScreenSize();
		int screenX = (int) screen.getWidth();
		int screenY = (int) screen.getHeight();
		int windowX = this.getWidth();
		int windowY = this.getHeight();
		int xPosition = (screenX - windowX) /2;
		int yPosition = (screenY - windowY) /2;
		this.setLocation(xPosition, yPosition);
					
		JButton fullscreen = new JButton("Fullscreen");
		fullscreen.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				doFullScreen = true;
				setVisible(false);
			}
		});
		JButton windowed = new JButton("Windowed");
		windowed.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				doFullScreen = false;
				setVisible(false);
			}
		});
		
		JLabel label = new JLabel("How would you like to run the game?", JLabel.CENTER);
		
		GridBagLayout layout = new GridBagLayout();
		this.setLayout(layout);
		
		GridBagConstraints Cfull = new GridBagConstraints();
		Cfull.weightx = 100;
		Cfull.weighty = 100;
		Cfull.gridx = 1;
		Cfull.gridy = 1;
		Cfull.gridwidth = 1;
		Cfull.gridheight = 1;
		//Cfull.fill = GridBagConstraints.BOTH;
		
		GridBagConstraints Cwindow = new GridBagConstraints();
		Cwindow.weightx = 100;
		Cwindow.weighty = 100;
		Cwindow.gridx = 0;
		Cwindow.gridy = 1;
		Cwindow.gridwidth = 1;
		Cwindow.gridheight = 1;
		//Cwindow.fill = GridBagConstraints.BOTH;
		
		GridBagConstraints Clab = new GridBagConstraints();
		Clab.weightx = 100;
		Clab.weighty = 100;
		Clab.gridx = 0;
		Clab.gridy = 0;
		Clab.gridwidth = 2;
		Clab.gridheight = 1;
		Clab.fill = GridBagConstraints.BOTH;
				
		this.add(label, Clab);
		this.add(windowed, Cwindow);
		this.add(fullscreen, Cfull);		
	
	}
	
	public boolean getFullScreen() {
		return doFullScreen;
	}	
	
}
